
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
# @file   : pwd_strength.py
# @author : weichy
# @date   : 2019/01/05
# @version: 1.0
# @desc   :  1.0通过计算机程序模拟掷骰子，一个骰子
                2.0模拟投2颗骰子
            
'''



import random   

def roll_dice():
    '''
    模拟掷骰子
    '''
    roll = random.randint(1,6)
    return roll

def main():
    total_times = 10000


    # 初始化列表[00000]

    result_list = [0] * 11
    # 初始化点数列表
    roll_list = list(range(2,13))
    roll_dict = dict(zip(roll_list,result_list))
    for i in range(total_times):
        roll_one = roll_dice()
        roll_two = roll_dice()
        for j in range(2,13):
            if (roll_one + roll_two) == j:
                roll_dict[j] += 1
    for i,result in roll_dict.items():
        print('点数{}的次数：{}，频率为：{}。'.format(i,result,result/total_times))
  


if __name__ == '__main__':
    main()
